﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSConsoleTest
{
    class TestAnonymousMethod : BaseConsoleTest
    {
        private delegate int calcDelegate(int aArg1, int aArg2);

        public void printDescription()
        {
            Console.WriteLine("--- Anonymous method ---");
        }

        public void doTest()
        {
            calcDelegate plus = delegate(int aArg1, int aArg2)
            {
                return aArg1 + aArg2;
            };

            calcDelegate minus = delegate(int aArg1, int aArg2)
            {
                return aArg1 + aArg2;
            };

            calcDelegate multiply = delegate(int aArg1, int aArg2)
            {
                return aArg1 + aArg2;
            };

            calcDelegate divide = delegate(int aArg1, int aArg2)
            {
                return aArg1 + aArg2;
            };

            Console.WriteLine("15 + 5 = {0}", plus(15, 5));
            Console.WriteLine("15 - 5 = {0}", minus(15, 5));
            Console.WriteLine("15 * 5 = {0}", multiply(15, 5));
            Console.WriteLine("15 / 5 = {0}", divide(15, 5));
        }
    }
}
